<template>
  <a-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'xingMing', validatorRules.xingMing]"
                placeholder="请输入姓名"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="身份证号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'shenFenZhengHao', validatorRules.shenFenZhengHao]"
                placeholder="请输入身份证号"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="民族" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['minZu', validatorRules.minZu]"
                :trigger-change="true"
                dictCode="gkak_mz"
                placeholder="请选择民族"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="婚姻状况" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['hunYinZhuangKuang', validatorRules.hunYinZhuangKuang]"
                :trigger-change="true"
                dictCode="gkak_hyzk"
                placeholder="请选择婚姻状况"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="籍贯" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jiGuan', validatorRules.jiGuan]"
                placeholder="请输入籍贯"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="户籍性质" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['huJiXingZhi', validatorRules.huJiXingZhi]"
                :trigger-change="true"
                dictCode="gkak_hjxz"
                placeholder="请选择户籍性质"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="结婚纪念日" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date
                placeholder="请选择结婚纪念日"
                v-decorator="[ 'jieHunJiNianRi', validatorRules.jieHunJiNianRi]"
                :trigger-change="true"
                style="width: 100%"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="学历" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['xueLi', validatorRules.xueLi]"
                :trigger-change="true"
                dictCode="gkak_xl"
                placeholder="请选择学历"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="职业" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'zhuanYe', validatorRules.zhuanYe]"
                placeholder="请输入职业"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="职称" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'zhiCheng', validatorRules.zhiCheng]"
                placeholder="请输入职称"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="原工作单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'yuanGongZuoDanWei', validatorRules.yuanGongZuoDanWei]"
                placeholder="请输入原工作单位"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="宗教" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['zongJiao', validatorRules.zongJiao]"
                :trigger-change="true"
                dictCode="gkak_zj"
                placeholder="请选择宗教"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="老人类别" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'laoRenLeiBie', validatorRules.laoRenLeiBie]"
                placeholder="请输入老人类别"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="子女情况" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'ziNvQingKuang', validatorRules.ziNvQingKuang]"
                placeholder="请输入子女情况"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="亲属" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'qinShu', validatorRules.qinShu]"
                placeholder="请输入亲属"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="行政区" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <!-- <a-cascader
                :options="options"
                :showSearch="{ filter }"
                @change="onChangeXZQ"
                changeOnSelect
                placeholder="请选择行政区"
                v-decorator="[ 'xingZhengQvId', validatorRules.xingZhengQvId]"
              />-->
              <a-cascader
                :options="options"
                @change="onChangeXZQ"
                placeholder="请选择行政区"
                changeOnSelect
                :loadData="loadData"
                v-decorator="[ 'xingZhengQvId', validatorRules.xingZhengQvId]"
                :disabled="disableSubmit"
              />


              <!-- <a-input
                v-decorator="[ 'xingZhengQvId', validatorRules.xingZhengQvId]"
                placeholder="请输入行政区"
              ></a-input>-->
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="社区" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                @click.native="showModalSQ"
                v-model="shequMC"
                placeholder="请选择社区"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-modal
            centered
            title="社区"
            :visible="visibleSQ"
            @ok="handleOkSQ"
            @cancel="handleCancelSQ"
            width="900px"
          >
            <a-row :gutter="24">
              <div class="table-page-search-wrapper">
                <a-form layout="inline">
                  <a-row :gutter="24">
                    <a-col :span="14">
                      <a-form-item label="社区名称">
                        <a-input placeholder="请输入" v-model="searchSQ" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="8">
                      <span
                        style="float: left;overflow: hidden;"
                        class="table-page-search-submitButtons"
                      >
                        <a-button type="primary" icon="search" @click.native="search(1)">查询</a-button>
                        <a-button
                          type="primary"
                          icon="reload"
                          @click.native="reset(1)"
                          style="margin-left: 8px"
                        >重置</a-button>
                      </span>
                    </a-col>
                  </a-row>
                </a-form>
              </div>
              <a-table
                bordered
                rowKey="id"
                :columns="columnsSQ"
                :dataSource="dataSQ"
                :loading="loading"
                :pagination="false"
              >
                <template slot="action" slot-scope="text, record">
                  <a @click="() => seve(record,1)">选择</a>
                </template>
              </a-table>
              <a-pagination
                style="margin-top:20px;float:right"
                showQuickJumper
                :defaultCurrent="1"
                :total="total"
                @change="onChangeSQ"
              />
            </a-row>
          </a-modal>
          <a-col :span="12">
            <a-form-item label="楼宇" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                @click.native="showModalLY"
                v-model="louyuMC"
                placeholder="请选择楼宇"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-modal
            centered
            title="楼宇"
            :visible="visibleLY"
            @ok="handleOkLY"
            @cancel="handleCancelLY"
            width="900px"
          >
            <a-row :gutter="24">
              <div class="table-page-search-wrapper">
                <a-form layout="inline">
                  <a-row :gutter="24">
                    <a-col :span="14">
                      <a-form-item label="楼宇名称">
                        <a-input placeholder="请输入" v-model="searchLY" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="8">
                      <span
                        style="float: left;overflow: hidden;"
                        class="table-page-search-submitButtons"
                      >
                        <a-button type="primary" @click.native="search(2)" icon="search">查询</a-button>
                        <a-button
                          type="primary"
                          icon="reload"
                          @click.native="reset(2)"
                          style="margin-left: 8px"
                        >重置</a-button>
                      </span>
                    </a-col>
                  </a-row>
                </a-form>
              </div>
              <a-table
                bordered
                rowKey="id"
                :columns="columnsLY"
                :dataSource="dataLY"
                :loading="loading"
                :pagination="false"
              >
                <template slot="action" slot-scope="text, record">
                  <a @click="() => seve(record,2)">选择</a>
                </template>
              </a-table>
              <a-pagination
                style="margin-top:20px;float:right"
                showQuickJumper
                :defaultCurrent="1"
                :total="total"
                @change="onChangeLY"
              />
            </a-row>
          </a-modal>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="房间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                @click.native="showModalFJ"
                v-model="fangjianMC"
                placeholder="请选择房间"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-modal
            centered
            title="房间"
            :visible="visibleFJ"
            @ok="handleOkFJ"
            @cancel="handleCancelFJ"
            width="900px"
          >
            <a-row :gutter="24">
              <div class="table-page-search-wrapper">
                <a-form layout="inline">
                  <a-row :gutter="24">
                    <a-col :span="14">
                      <a-form-item label="房间号">
                        <a-input placeholder="请输入" v-model="searchFJ" />
                      </a-form-item>
                    </a-col>
                    <a-col :span="8">
                      <span
                        style="float: left;overflow: hidden;"
                        class="table-page-search-submitButtons"
                      >
                        <a-button type="primary" @click.native="search(3)" icon="search">查询</a-button>
                        <a-button
                          type="primary"
                          icon="reload"
                          @click.native="reset(3)"
                          style="margin-left: 8px"
                        >重置</a-button>
                      </span>
                    </a-col>
                  </a-row>
                </a-form>
              </div>
              <a-table
                bordered
                rowKey="id"
                :columns="columnsFJ"
                :dataSource="dataFJ"
                :loading="loading"
                :pagination="false"
              >
                <template slot="action" slot-scope="text, record">
                  <a @click="() => seve(record,3)">选择</a>
                </template>
              </a-table>
              <a-pagination
                style="margin-top:20px;float:right"
                showQuickJumper
                :defaultCurrent="1"
                :total="total"
                @change="onChangeFJ"
              />
            </a-row>
          </a-modal>
          <a-col :span="12">
            <a-form-item label="政治面貌" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['zhengZhiMianMao', validatorRules.zhengZhiMianMao]"
                :trigger-change="true"
                dictCode="gkak_zzmm"
                placeholder="请选择政治面貌"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="家庭成员情况" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jiaTingChengYuanQingKuang', validatorRules.jiaTingChengYuanQingKuang]"
                placeholder="请输入家庭成员情况"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="社保号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'sheBaoHao', validatorRules.sheBaoHao]"
                placeholder="请输入社保号"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="老年证号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'laoNianZhengHao', validatorRules.laoNianZhengHao]"
                placeholder="请输入老年证号"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="养老方式" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['yangLaoFangShi', validatorRules.yangLaoFangShi]"
                :trigger-change="true"
                dictCode="gkak_ylfs"
                placeholder="请选择养老方式"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="终端类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['zhongDuanLeiXing', validatorRules.zhongDuanLeiXing]"
                :trigger-change="true"
                dictCode="gkak_zdlx"
                placeholder="请选择终端类型"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="终端号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'zhongDuanHaoMa', validatorRules.zhongDuanHaoMa]"
                placeholder="请输入终端号码"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="安装时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date
                placeholder="请选择安装时间"
                v-decorator="[ 'anZhuangShiJian', validatorRules.anZhuangShiJian]"
                :trigger-change="true"
                style="width: 100%"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="附近医院" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'fuJinYiYuan', validatorRules.fuJinYiYuan]"
                placeholder="请输入附近医院"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="附近活动场所" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'fuJinHuoDongChangSuo', validatorRules.fuJinHuoDongChangSuo]"
                placeholder="请输入附近活动场所"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="紧急联系人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jinJiLianXiRen', validatorRules.jinJiLianXiRen]"
                placeholder="请输入紧急联系人"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="紧急联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jinJiLianXiDianHua', validatorRules.jinJiLianXiDianHua]"
                placeholder="请输入紧急联系电话"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="附近公交地铁" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'fuJinGongJiaoDiTie', validatorRules.fuJinGongJiaoDiTie]"
                placeholder="请输入附近公交地铁"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="服务需求" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['fuWuXuQiu', validatorRules.fuWuXuQiu]"
                :trigger-change="true"
                dictCode="gkak_fwxq"
                placeholder="请选择服务需求"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="特长" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'teZhang', validatorRules.teZhang]"
                placeholder="请输入特长"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="爱好" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'aiHao', validatorRules.aiHao]"
                placeholder="请输入爱好"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="身高体重血型" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'shenGaoTiZhongXueXing', validatorRules.shenGaoTiZhongXueXing]"
                placeholder="请输入身高体重血型"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="生活习惯" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'shengHuoXiGuan', validatorRules.shengHuoXiGuan]"
                placeholder="请输入生活习惯"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="疾病手术历史" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jiBingShouShuLiShi', validatorRules.jiBingShouShuLiShi]"
                placeholder="请输入疾病手术历史"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="家族遗传" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jiaZuYiChuan', validatorRules.jiaZuYiChuan]"
                placeholder="请输入家族遗传"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="身体残疾信息" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'shenTiCanJiXinXi', validatorRules.shenTiCanJiXinXi]"
                placeholder="请输入身体残疾信息"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="紧急联系人姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jinJiLianXiRenXingMing', validatorRules.jinJiLianXiRenXingMing]"
                placeholder="请输入紧急联系人姓名"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="紧急联系人电话" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jinJiLianXiRenDianHua', validatorRules.jinJiLianXiRenDianHua]"
                placeholder="请输入紧急联系人电话"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="紧急联系人关系" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-dict-select-tag
                type="list"
                v-decorator="['jinJiLianXiRenGuanXi', validatorRules.jinJiLianXiRenGuanXi]"
                :trigger-change="true"
                dictCode="gkak-lxrgx"
                placeholder="请选择紧急联系人关系"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="紧急联系人住址" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'jinJiLianXiRenZhuZhi', validatorRules.jinJiLianXiRenZhuZhi]"
                placeholder="请输入紧急联系人住址"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="慢性病种类" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-multi-select-tag
                type="list_multi"
                v-decorator="['manXingBingZhongLei', validatorRules.manXingBingZhongLei]"
                :trigger-change="true"
                dictCode="gkak_mxbzl"
                placeholder="请选择慢性病种类"
                :disabled="disableSubmit"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="居住地址" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input
                v-decorator="[ 'juZhuDiZhi', validatorRules.juZhuDiZhi]"
                placeholder="请输入居住地址"
                :disabled="disableSubmit"
              ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import JDate from '@/components/jeecg/JDate'
import JDictSelectTag from '@/components/dict/JDictSelectTag'
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
export default {
  name: 'GkakRJianKangXinXiModal',
  components: {
    JDate,
    JDictSelectTag,
    JMultiSelectTag
  },
  data() {
    return {
      form: this.$form.createForm(this),
      title: '操作',
      disableSubmit: false,
      width: 1200,
      visible: false,
      // 查询
      sheQuObj: {},
      louYuObj: {},
      fangJianObj: {},
      searchSQ: '',
      searchLY: '',
      searchFJ: '',
      visibleSQ: false,
      visibleLY: false,
      visibleFJ: false,
      loading: true,
      dataSQ: [],
      dataLY: [],
      dataFJ: [],
      shequID: undefined,
      shequMC: undefined,
      louyuID: undefined,
      louyuMC: undefined,
      fangjianID: undefined,
      fangjianMC: undefined,
      columnsSQ: [
        { title: '社区名称', dataIndex: 'mingCheng', align: 'center' },
        // { title: '编号', dataIndex: 'id', align: 'center' },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 170,
          scopedSlots: { customRender: 'action' }
        }
      ],
      columnsLY: [
        { title: '楼宇名称', dataIndex: 'jianZhuMingCheng', align: 'center' },
        // { title: '编号', dataIndex: 'bianHao', align: 'center' },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 170,
          scopedSlots: { customRender: 'action' }
        }
      ],
      columnsFJ: [
        { title: '单元号', dataIndex: 'danYuanHao', align: 'center' },
        { title: '楼层', dataIndex: 'suoShuLouCeng', align: 'center' },
        { title: '房间号', dataIndex: 'fangJianBianHao', align: 'center' },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 170,
          scopedSlots: { customRender: 'action' }
        }
      ],
      total: 0,
      options: [],
      xzqID: undefined,

      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
      confirmLoading: false,
      validatorRules: {
        xingMing: { rules: [{ required: true, message: '请输入姓名!' }] },
        shenFenZhengHao: { rules: [{ required: true, message: '请输入身份证号!' }] },
        minZu: { rules: [] },
        hunYinZhuangKuang: { rules: [] },
        jiGuan: { rules: [{ required: true, message: '请输入籍贯!' }] },
        huJiXingZhi: { rules: [{ required: true, message: '请输入户籍性质!' }] },
        jieHunJiNianRi: { rules: [] },
        xueLi: { rules: [] },
        zhuanYe: { rules: [] },
        zhiCheng: { rules: [] },
        yuanGongZuoDanWei: { rules: [] },
        zongJiao: { rules: [] },
        laoRenLeiBie: { rules: [] },
        ziNvQingKuang: { rules: [{ required: true, message: '请输入子女情况!' }] },
        qinShu: { rules: [] },
        xingZhengQvId: { rules: [] },
        sheQvId: { rules: [] },
        louYvId: { rules: [] },
        fangJianId: { rules: [] },
        zhengZhiMianMao: { rules: [] },
        jiaTingChengYuanQingKuang: { rules: [] },
        sheBaoHao: { rules: [] },
        laoNianZhengHao: { rules: [] },
        yangLaoFangShi: { rules: [] },
        zhongDuanLeiXing: { rules: [] },
        zhongDuanHaoMa: { rules: [] },
        anZhuangShiJian: { rules: [] },
        fuJinYiYuan: { rules: [] },
        fuJinHuoDongChangSuo: { rules: [] },
        jinJiLianXiRen: { rules: [] },
        jinJiLianXiDianHua: { rules: [] },
        fuJinGongJiaoDiTie: { rules: [] },
        fuWuXuQiu: { rules: [] },
        teZhang: { rules: [] },
        aiHao: { rules: [] },
        shenGaoTiZhongXueXing: { rules: [] },
        shengHuoXiGuan: { rules: [] },
        jiBingShouShuLiShi: { rules: [] },
        jiaZuYiChuan: { rules: [] },
        shenTiCanJiXinXi: { rules: [] },
        jinJiLianXiRenXingMing: { rules: [] },
        jinJiLianXiRenDianHua: { rules: [] },
        jinJiLianXiRenGuanXi: { rules: [] },
        jinJiLianXiRenZhuZhi: { rules: [] },
        manXingBingZhongLei: { rules: [] },
        juZhuDiZhi: { rules: [] }
      },
      url: {
        list:'',
        add: '/org.jeecg.modules.gkak.primary/gkakRJianKangXinXi/add',
        edit: '/org.jeecg.modules.gkak.primary/gkakRJianKangXinXi/edit'
      }
    }
  },
  created() {
    // this.xingzhengqulList()
  },
  methods: {
    // 行政区
    onChangeXZQ(value) {
      
      this.xzqID = value[value.length - 1]

      this.shequID = undefined
      this.shequMC = undefined
      this.louyuID = undefined
      this.louyuMC = undefined
      this.fangjianID = undefined
      this.fangjianMC = undefined
    },
    loadData(selectedOptions) {
      const targetOption = selectedOptions[selectedOptions.length - 1]
      // targetOption.loading = true
      getAction(
        `/gkakKongJianController/getXingZhengQvByPid?pid=${selectedOptions[selectedOptions.length - 1].value}&lavel=${
          selectedOptions[selectedOptions.length - 1].lavel
        }`,
        {}
      ).then(res => {
        if (res.success) {
          // targetOption.loading = false
          targetOption.children = [] //先重置空
          for (let i = 0; i < res.result.length; i++) {
            targetOption.children.push(res.result[i])
          }
          this.options = [...this.options]
        }
      })
    },
    xingzhengqulList() {
      getAction(`/gkakKongJianController/getXingZhengQvByPid?pid=${0}&lavel=${0}`, {}).then(res => {
        if (res.success) {
          this.options = res.result
        }
      })
    },
    filter(inputValue, path) {
      return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
    },
    // 重置
    reset(type) {
      if (type == 1) {
        this.searchSQ = ''
      } else if (type == 2) {
        this.searchLY = ''
      } else if (type == 3) {
        this.searchFJ = ''
      }
    },
    // 查询
    search(type) {
      if (type == 1) {
        getAction(`/gkakKongJianController/querySheQvByXingZhengQv`, {
          sheQvMingCheng: this.searchSQ,
          pageNo: 1,
          pageSize: 5
        }).then(res => {
          if (res.success) {
            this.dataSQ = res.result.records
            this.total = res.result.total
            this.loading = false
          }
        })
      } else if (type == 2) {
        getAction(`/gkakKongJianController/queryLouYvBySheQv?sheQvId=${this.shequID}`, {
          louYvMingCheng: this.searchLY,
          pageNo: 1,
          pageSize: 5
        }).then(res => {
          if (res.success) {
            this.dataLY = res.result.records
            this.loading = false
          }
        })
      } else if (type == 3) {
        getAction(`/gkakKongJianController/queryFangJianByLouYv?louYvId =${this.louyuID}`, {
          fangJianBianHao: this.searchFJ,
          pageNo: 1,
          pageSize: 5
        }).then(res => {
          if (res.success) {
            this.dataFJ = res.result.records
            this.loading = false
          }
        })
      }
    },
    // 分页
    onChangeSQ(pageNumber) {
      getAction(`/gkakKongJianController/querySheQvByXingZhengQv`, {
        pageNo: pageNumber,
        pageSize: 5
      }).then(res => {
        if (res.success) {
          this.dataSQ = res.result.records
          this.loading = false
        }
      })
    },
    onChangeLY(pageNumber) {
      getAction(`/gkakKongJianController/queryLouYvBySheQv?sheQvId=${this.shequID}`, {
        pageNo: pageNumber,
        pageSize: 5
      }).then(res => {
        if (res.success) {
          this.dataLY = res.result.records
          this.loading = false
        }
      })
    },
    onChangeFJ(pageNumber) {
      getAction(`/gkakKongJianController/queryFangJianByLouYv?louYvId =${this.louyuID}`, {
        pageNo: 1,
        pageSize: 5
      }).then(res => {
        if (res.success) {
          this.dataFJ = res.result.records
          this.loading = false
        }
      })
    },
    // 弹窗
    showModalSQ() {
      this.visibleSQ = true
      this.searchSQ = ''
      this.searchLY = ''
      this.searchFJ = ''
      if (this.xzqID) {
        getAction(`/gkakKongJianController/querySheQvByXingZhengQv?xingZhengQvId=${this.xzqID}`, {
          pageNo: 1,
          pageSize: 5
        }).then(res => {
          if (res.success) {
            this.dataSQ = res.result.records
            this.total = res.result.total
            this.loading = false
          }
        })
      } else {
        this.dataSQ = []
        this.total = 0
        this.loading = false
      }
    },
    showModalLY() {
      this.visibleLY = true
      getAction(`/gkakKongJianController/queryLouYvBySheQv?sheQvId=${this.shequID}`, {
        pageNo: 1,
        pageSize: 5
      }).then(res => {
        if (res.success) {
          this.dataLY = res.result.records
          this.total = res.result.total
          this.loading = false
        }
      })
    },
    showModalFJ() {
      this.visibleFJ = true
      getAction(`/gkakKongJianController/queryFangJianByLouYv?louYvId=${this.louyuID}`, {
        pageNo: 1,
        pageSize: 5
      }).then(res => {
        if (res.success) {
          this.dataFJ = res.result.records
          this.total = res.result.total
          this.loading = false
        }
      })
    },
    // 确定
    handleOkSQ(e) {
      this.visibleSQ = false
    },
    handleOkLY(e) {
      this.visibleLY = false
    },
    handleOkFJ(e) {
      this.visibleFJ = false
    },
    // 取消
    handleCancelSQ(e) {
      this.visibleSQ = false
    },
    handleCancelLY(e) {
      this.visibleLY = false
    },
    handleCancelFJ(e) {
      this.visibleFJ = false
    },
    // 选择
    seve(row, type) {
      if (type == 1) {
        this.shequID = row.id
        this.shequMC = row.mingCheng
        this.visibleSQ = false

        this.louyuID = undefined
        this.louyuMC = undefined

        this.fangjianID = undefined
        this.fangjianMC = undefined
      } else if (type == 2) {
        this.louyuID = row.id
        this.louyuMC = row.jianZhuMingCheng
        this.visibleLY = false

        this.fangjianID = undefined
        this.fangjianMC = undefined
      } else if (type == 3) {
        this.fangjianID = row.id
        this.fangjianMC = row.danYuanHao + row.suoShuLouCeng + row.fangJianBianHao
        this.visibleFJ = false
      }
    },

    add() {
      this.edit({})
    },
    edit(record) {
      
      if (record.sheQvId && record.sheQvId != '0') {
        getAction(`/gkakKongJianController/querySheQvNameById?id=${record.sheQvId}`, {}).then(res => {
          if (res.success) {
            
            this.shequID = res.result.sheQuBianHao
            this.shequMC = res.result.mingCheng
          }
        })
      }
      if (record.louYvId && record.louYvId != '0') {
        getAction(`/gkakKongJianController/queryLouYvNameById?id=${record.louYvId}`, {}).then(res => {
          if (res.success) {
            this.louyuID = res.result.id
            this.louyuMC = res.result.jianZhuMingCheng
          }
        })
      }
      if (record.fangJianId && record.fangJianId != '0') {
        getAction(`/gkakKongJianController/queryFangJianNameById?id=${record.fangJianId}`, {}).then(res => {
          if (res.success) {
            this.fangjianID = res.result.id
            this.fangjianMC = res.result.danYuanHao + res.result.suoShuLouCeng + res.result.fangJianBianHao
          }
        })
      }
      this.form.resetFields()
      this.model = Object.assign({}, record)
      getAction(`/gkakKongJianController/getXingZhengQvByPid?pid=${0}&lavel=${0}`, {}).then(res => {
        if (res.success) {
          
          this.options = res.result
        }
      })
      if (record.xingZhengQvId) {
        this.model.xingZhengQvId = record.xingZhengQvId.split(',')
        let newID = this.model.xingZhengQvId
        this.xzqID = newID[newID.length - 1]
        if (newID && newID[0]) {
          getAction(`/gkakKongJianController/getXingZhengQvByPid?pid=${newID[0]}&lavel=${1}`).then(res => {
            if (res.success) {
              this.options.forEach((k, index) => {
                if (k.value == newID[0]) {
                  k.children = []
                  for (let i = 0; i < res.result.length; i++) {
                    k.children.push(res.result[i])
                  }
                }
              })
              this.options = [...this.options]
              if (newID && newID[1]) {
                getAction(`/gkakKongJianController/getXingZhengQvByPid?pid=${newID[1]}&lavel=${2}`).then(res => {
                  if (res.success) {
                    this.options.forEach((k, index) => {
                      k.children &&
                        k.children.forEach(j => {
                          if (j.value == newID[1]) {
                            j.children = []
                            for (let i = 0; i < res.result.length; i++) {
                              j.children.push(res.result[i])
                            }
                          }
                        })
                    })
                    this.options = [...this.options]
                    if (newID && newID[2]) {
                      getAction(`/gkakKongJianController/getXingZhengQvByPid?pid=${newID[2]}&lavel=${3}`).then(res => {
                        if (res.success) {
                          this.options.forEach((k, index) => {
                            k.children &&
                              k.children.forEach(j => {
                                j.children &&
                                  j.children.forEach(t => {
                                    if (t.value == newID[2]) {
                                      t.children = []
                                      for (let i = 0; i < res.result.length; i++) {
                                        t.children.push(res.result[i])
                                      }
                                    }
                                  })
                              })
                          })
                          this.options = [...this.options]
                        }
                      })
                    }
                  }
                })
              }
            }
          })
        }
      }
      this.visible = true
      debugger
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(
            this.model,
            'xingMing',
            'shenFenZhengHao',
            'minZu',
            'hunYinZhuangKuang',
            'jiGuan',
            'huJiXingZhi',
            'jieHunJiNianRi',
            'xueLi',
            'zhuanYe',
            'zhiCheng',
            'yuanGongZuoDanWei',
            'zongJiao',
            'laoRenLeiBie',
            'ziNvQingKuang',
            'qinShu',
            'xingZhengQvId',
            'sheQvId',
            'louYvId',
            'fangJianId',
            'zhengZhiMianMao',
            'jiaTingChengYuanQingKuang',
            'sheBaoHao',
            'laoNianZhengHao',
            'yangLaoFangShi',
            'zhongDuanLeiXing',
            'zhongDuanHaoMa',
            'anZhuangShiJian',
            'fuJinYiYuan',
            'fuJinHuoDongChangSuo',
            'jinJiLianXiRen',
            'jinJiLianXiDianHua',
            'fuJinGongJiaoDiTie',
            'fuWuXuQiu',
            'teZhang',
            'aiHao',
            'shenGaoTiZhongXueXing',
            'shengHuoXiGuan',
            'jiBingShouShuLiShi',
            'jiaZuYiChuan',
            'shenTiCanJiXinXi',
            'jinJiLianXiRenXingMing',
            'jinJiLianXiRenDianHua',
            'jinJiLianXiRenGuanXi',
            'jinJiLianXiRenZhuZhi',
            'manXingBingZhongLei',
            'juZhuDiZhi'
          )
        )
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.shequID = undefined
      this.shequMC = undefined
      this.louyuID = undefined
      this.louyuMC = undefined
      this.fangjianID = undefined
      this.fangjianMC = undefined
      this.xzqID = undefined
      this.options = []
    },
    handleOk() {
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true
          let httpurl = ''
          let method = ''
          if (!this.model.id) {
            httpurl += this.url.add
            method = 'post'
          } else {
            httpurl += this.url.edit
            method = 'put'
          }
          if (this.shequID) {
            values.sheQvId = this.shequID
          } else {
            values.sheQvId = '0'
          }
          if (this.louyuID) {
            values.louYvId = this.louyuID
          } else {
            values.louYvId = '0'
          }
          if (this.fangjianID) {
            values.fangJianId = this.fangjianID
          } else {
            values.fangJianId = '0'
          }
          if (values.xingZhengQvId) {
            values.xingZhengQvId = values.xingZhengQvId.join()
          }
          let formData = Object.assign(this.model, values)
          console.log('表单提交数据', formData)
          httpAction(httpurl, formData, method)
            .then(res => {
              if (res.success) {
                that.$message.success(res.message)
                that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              that.close()
            })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    popupCallback(row) {
      
      this.form.setFieldsValue(
        pick(
          row,
          'xingMing',
          'shenFenZhengHao',
          'minZu',
          'hunYinZhuangKuang',
          'jiGuan',
          'huJiXingZhi',
          'jieHunJiNianRi',
          'xueLi',
          'zhuanYe',
          'zhiCheng',
          'yuanGongZuoDanWei',
          'zongJiao',
          'laoRenLeiBie',
          'ziNvQingKuang',
          'qinShu',
          'xingZhengQvId',
          'sheQvId',
          'louYvId',
          'fangJianId',
          'zhengZhiMianMao',
          'jiaTingChengYuanQingKuang',
          'sheBaoHao',
          'laoNianZhengHao',
          'yangLaoFangShi',
          'zhongDuanLeiXing',
          'zhongDuanHaoMa',
          'anZhuangShiJian',
          'fuJinYiYuan',
          'fuJinHuoDongChangSuo',
          'jinJiLianXiRen',
          'jinJiLianXiDianHua',
          'fuJinGongJiaoDiTie',
          'fuWuXuQiu',
          'teZhang',
          'aiHao',
          'shenGaoTiZhongXueXing',
          'shengHuoXiGuan',
          'jiBingShouShuLiShi',
          'jiaZuYiChuan',
          'shenTiCanJiXinXi',
          'jinJiLianXiRenXingMing',
          'jinJiLianXiRenDianHua',
          'jinJiLianXiRenGuanXi',
          'jinJiLianXiRenZhuZhi',
          'manXingBingZhongLei',
          'juZhuDiZhi'
        )
      )
    }
  }
}
</script>